<template>
    <!-- 上传视频管理的搜索（模糊查）组件 -->
    <div class="app-container">
        <el-form :inline="true" :model="formInline" class="souSuo demo-form-inline">
            <el-form-item label="视频编号">
                <el-input v-model="formInline.videoId" placeholder="输入视频编号"></el-input>
              </el-form-item>
            <el-form-item label="话题" class="itemF">
              <el-input v-model="formInline.topic" placeholder="输入话题" style="width: 120px;"></el-input>
            </el-form-item>
            <el-form-item label="上传用户" class="itemF">
                <el-input v-model="formInline.userAccount" placeholder="输入上传用户名"></el-input>
            </el-form-item>
            <!-- <br/> -->
            <el-form-item label="上传时间" class="itemF">
                <el-date-picker
                    v-model="creationTime"
                    type="daterange"
                    
                    value-format="yyyy-MM-dd"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期">
                </el-date-picker>
            </el-form-item>
            <el-form-item v-if="vrFlag" label="审核时间">
                <el-date-picker
                    v-model="auditTime"
                    type="daterange"
                    
                    value-format="yyyy-MM-dd"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期">
                </el-date-picker>
            </el-form-item>
            <el-form-item :class="{'itemB': !vrFlag}">
              <el-button type="primary" icon="el-icon-search" @click="videoSearch">查询</el-button>
              <el-button type="primary" icon="el-icon-refresh-left" @click="resetSearch">重置</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>

<script>
import {listData,listDataT,listDataW} from '@/api/video/videoReview';
export default {
    props: ['vrFlag','tabE','handleSearch'],
    data() {
      return {
        videoTable:[],
        creationTime:[],
        auditTime:[],
        total:0,
        formInline: {
          videoId: '',
          topic: '',
          userAccount:'',
          UploadStartTime:'',
          UploadEndTime:'',
          auditStartTime:'',
          auditEndTime:'',
        }
      }
    },
    methods: {
      videoSearch(){
        if(this.creationTime == null){
          this.formInline.UploadStartTime = ''
          this.formInline.UploadEndTime = ''  
        }else{
          this.formInline.UploadStartTime = this.creationTime[0] //开始时间 获取数组中的第一个值
          this.formInline.UploadEndTime = this.creationTime[1]   //结束时间 获取数组中的第二个值
        }
        if(this.auditTime == null){
          this.formInline.auditStartTime = ''
          this.formInline.auditEndTime = ''
        }else{
          this.formInline.auditStartTime = this.auditTime[0] //开始时间 获取数组中的第一个值
          this.formInline.auditEndTime = this.auditTime[1]   //结束时间 获取数组中的第二个值
        }
        if(this.formInline.UploadEndTime){
            let dateTimeString = this.formInline.UploadEndTime + " 23:59:59";
            this.formInline.UploadEndTime = dateTimeString
        }
        if(this.formInline.auditEndTime){
            let dateTimeString = this.formInline.auditEndTime + " 23:59:59";
            this.formInline.auditEndTime = dateTimeString
        }
        if(this.tabE==0){
          listData(this.formInline).then(res =>{
            const bs = 0
            this.handleSearch(res,bs);
          })
        }else if(this.tabE==1){
          listDataT(this.formInline).then(res =>{
            const bs = 1
            this.handleSearch(res,bs);
          })
        }else{
          listDataW(this.formInline).then(res =>{
            const bs = 2
            this.handleSearch(res,bs);
          })
        }
      },

      resetSearch(){
        this.formInline = {}
        this.creationTime=[]
        this.auditTime=[]
      }
    }
}
</script>

<style scoped>
.reviewSelect{
    width: 135px;
}
.itemF{
    margin-left: 10px;
}
.souSuo{
  position: relative;
}
.itemB{
  position: absolute;
  top:60px;
  right: 16px;
}
</style>